#include<iostream>
using namespace std;
const int Max = 5;

int fill_array(double* arr, int limit);
void show_array(const double* arr, int limit);
void rate_array(double* arr, int limit, double rate);

int main()
{
	double money[Max]{};
	
	int size = fill_array(money, Max);
	
	show_array(money,size);
	
	cout << "give a rate:";
	double rate = 0;
	cin >> rate;
	rate_array(money, size, rate);
	show_array(money, size);
	return 0;
}

int fill_array(double* arr, int limit)
{
	int i = 0; 
	for (i = 0; i < limit; i++)
	{
		cout << "give NO." << i + 1 << " data:";
		if (!(cin >> arr[i]))
		{
			cin.clear();
			while (cin.get() != '\n');
			cout << "exit_input\n";
			break;
		}
		else if (arr[i] < 0)
			break;
	}
	return i;
}

void show_array(const double* arr, int limit)
{
	for (int i = 0; i < limit; i++)
		cout << "NO." << i + 1 << ":$" << arr[i] << endl;
}

void rate_array(double* arr, int limit, double rate)
{
	for (int i = 0; i < limit; i++)
		arr[i] *= rate;
}
